repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
All problems from Colombian National Contest 2009 are solved!
[andmenj-acm.git]
/
11428 - Cubes
/
#b.2.cpp#
blob
25c1d09bbcb82e9dfee0f1b395be23e015cb0ae0
1
#include<iostream>
2
#include<math.h>
3
using namespace std;
4
5
typdef unsigned long long ull;
6
ull cubo(ull x){
7
ull i=1;
8
while(i*i*i <= x){
9
++i;
10
}
11
--i;
12
// cout << i << endl;
13
if (i*i*i == x){
14
return i;
15
}else{
16
return INT_MAX;
17
}
18
}
19
20
int main(){
21
ull n;
22
while(cin>>n &&n){
23
ull y = 1;
24
bool encontre=false;
25
while (true){
26
ull r = cubo(n + (y*y*y));
27
// cout << "r es: " << r << " y es: " << y << endl;
28
if (r != INT_MAX){
29
cout << r << " " << y << endl;
30
encontre = true;
31
break;
32
}
33
++y;
34
if ((y+1)*(y+1)*(y+1) - y*y*y > n) break;
35
}
36
if (!encontre){
37
cout << "No solution\n";
38
continue;
39
}
40
}
41
}